# Contributor: Díaz Urbaneja Diego <sodomon2@gmail.com>
# Maintainer: Díaz Urbaneja Diego <sodomon2@gmail.com>
pkgname=cpu-x
pkgver=5.0.4
pkgrel=0
pkgdesc="CPU-X is a system profiling and monitoring application (similar to CPU-Z)"
url="https://thetumultuousunicornofdarkness.github.io/CPU-X/"
arch="x86_64 x86" # no libcpuid in others architectures
license="GPL-3.0-only"
depends="
	gtkmm3
	libcpuid
	ncurses
	mesa
	opencl
	pciutils
	procps-ng
	vulkan-loader
	"
makedepends="
	cmake
	gtkmm3-dev
	libcpuid-dev
	mesa-dev
	nasm
	ncurses-dev
	opencl-dev
	pciutils-dev
	procps-ng-dev
	samurai
	vulkan-headers
	vulkan-loader-dev
	"
subpackages="$pkgname-lang $pkgname-bash-completion $pkgname-zsh-completion $pkgname-fish-completion"
options="!check" # check failed
source="$pkgname-$pkgver.tar.gz::https://github.com/TheTumultuousUnicornOfDarkness/CPU-X/archive/refs/tags/v$pkgver.tar.gz
	no-bracktrace.patch
	"
builddir="$srcdir/CPU-X-$pkgver"

build() {
	# GLFW disable
	if [ "$CBUILD" != "$CHOST" ]; then
		local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DWITH_OPENCL=ON \
		-DWITH_LIBGLFW=OFF \
		-DCMAKE_BUILD_TYPE=None \
		$crossopts
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
134f8a8fe6782279f7288d891a66b3d426b0e173de3d5445367c94029aa9d33348d037f5bca25690aff16f00d261777a71de6847991e564578099b03ff398453  cpu-x-5.0.4.tar.gz
96f0e100a2ca2898b014ca5f52937a2de041743777fbf318e2d3f82240e9fe40106d295c2ce80478e1540ed35c96a98c70acd1549b89daae44f6d9ff88251734  no-bracktrace.patch
"
